Trim2 A double trim function. This function separates the input values in three categories defined by the “c” and the “d” parameters. Assuming that the “c” parameter is below the “d” parameter, the function behaves as follows: If the input value is less than the “c” parameter, the output value is equal to the “b” parameter. If the input value is between the “c” and the “d” parameters, the output value is calculated according to the following linear function: Output = b + (Input - c)(a - b)/(d - c) If the input value is greater than the “d” parameter, the output value is equal to the “a” parameter. If the “d” parameter is less than or equal to the “c” parameter, the “d” parameter is ignored, and the function behaves exactly like the Thresh1 function. In such cases you should simply use the Thresh1 function instead to avoid confusion. Note that the “a” parameter does not have to be greater than the “b” parameter. To obtain useful results, however, the “a” parameter should not be equal to the “b” parameter. (If you let “a” be equal to “b”, the output value will always be equal to this common value.) In the special case when “a” is equal to “d”, “b” is equal to “c”, and “c” is less than “d”, the Trim2 function takes the following simplified form: Output = Max(Min(Input, a), b) Hence, in this case input values less than “b” are replaced by “b”, input values greater than “a” are replaced by “a”, and all other input values are passed on unchanged. Default parameter values: a = 1, b = 0, c = 0, d = 1 Example: a = 4, b = 1, c = 2, d = 5 Input = 1 => Output = 1 Input = 4 => Output = 3 Input = 6 => Output = 4